#include "stdafx.h"
#include "ThreadImpl.h"
#include "platform.h"
#include "TaskQueue.h"

ThreadImpl::ThreadImpl()
{
}

ThreadImpl::~ThreadImpl()
{
}

bool ThreadImpl::init(void *param)
{
	id_ = 0;
	handle_ = 0;
	task_queue_ = NULL;
	return start_thread(param);
}

bool ThreadImpl::start_thread(void *param)
{
	return false;
}

ThreadImpl * ThreadImpl::create()
{
	ThreadImpl * inst = new ThreadImpl();
	if(inst->init(NULL))
		return inst;
	else
		inst->destroy();
	return NULL;
}


uint32_t ThreadImpl::get_handle()
{
	return handle_;
}

uint32_t ThreadImpl::get_id()
{
	return id_;
}

Thread::ThreadStatus ThreadImpl::get_status()
{
	return status_;
}

Thread::ThreadStatus ThreadImpl::run()
{
	ThreadStatus prev = status_;
	return prev;
}

Thread::ThreadStatus ThreadImpl::suspend()
{
	ThreadStatus prev = status_;
	return prev;
}

void ThreadImpl::destroy()
{
	delete this;
}

TaskQueue * ThreadImpl::get_task_queue() const
{
	return task_queue_;
}

void ThreadImpl::set_task_queue(TaskQueue *task_queue)
{
	task_queue_ = task_queue;
}